package com.miniits.base.all;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import java.io.*;

/**
 * @author: wq
 * @Date: 2018/3/21
 * @Time: 17:06
 * <p>
 * Description:
 * ***
 */
@Controller
@RequestMapping("/admin")
public class AdminIndexController {

    @Autowired
    private BetService betService;

    @GetMapping
    public String index(ModelMap modelMap) {
        return "admin/Index";
    }

    @GetMapping("/bc")
    public String bc(ModelMap modelMap) {
        modelMap.put("active", "users");
        return "admin/views/system/BC";
    }

    public static void main(String[] log) {
        bcPrint("123");
    }

    public static void bcPrint(String log) {
        PrintStream printStream = null;
        try {
            File file = new File("d:\\systemOut.log");
            if (!file.exists()) {
                try {
                    file.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            printStream = new PrintStream(new FileOutputStream(new File(
                    "d:\\systemOut.log"), true));
            System.setOut(printStream);
            System.setErr(printStream);
            System.out.println(log);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                printStream.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
